<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
        $this->app->singleton('sms', 'App\Services\SmsService');
        $this->app->singleton('email', 'App\Services\EmailService');
        $this->app->singleton('wxserver', 'App\Services\wxService');
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        \Schema::defaultStringLength(191);
        if (config("base.storeaddr") == 'loca') {
            config()->offsetSet('admin.upload.disk', 'admin');
        } elseif (config("base.storeaddr") == 'huaweiyun') {
            config()->offsetSet('filesystems.disks.obs.key', config("store.OBS_KEY"));
            config()->offsetSet('filesystems.disks.obs.secret', config("store.OBS_SECRET"));
            config()->offsetSet('filesystems.disks.obs.bucket', config("store.OBS_BUCKET"));
            config()->offsetSet('filesystems.disks.obs.endpoint', config("store.OBS_ENDPOINT"));
            config()->offsetSet('filesystems.disks.obs.cdn_domain', config("store.OBS_CDN_DOMAIN"));
            config()->offsetSet('admin.upload.disk', 'obs');
        }
    }
}
